﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for ProgramHandlerTester
/// </summary>
public class ProgramHandlerTester : TestClass
{
    //Reference to session!
    private System.Web.SessionState.HttpSessionState m_sessionReference;

    public ProgramHandlerTester (System.Web.SessionState.HttpSessionState a_session)
	{
        m_sessionReference = a_session;
	}

    /// <summary>
    /// Tests ProgramHandler tho it's kind of a visual test and to see that it doesn't crash
    /// </summary>    
    public override bool RunTest( )
    {       
        try
        {
            //Creates the "test model"
            ModelItem f_item = new ModelItem();
            f_item.EditName("Test2013" + DateTime.Now.ToString() );
            f_item.EditPath(Paths.ModelsFolder_relative + "TestModel.json");
            f_item.EditThumbnailPath(Paths.ThumbnailsFolder_relative + "player.jpg");
            f_item.EditShaders(new List<string>() { Strings.ModelItem.ShaderTypes.phong });

            string f_testModelName = "plane.fbx";

            string f_outputTestModel = Paths.serverRoot + Paths.ModelsFolder_relative + "test2013.json";

            ProgramHandler.TryToStartConverter(Paths.ModelsFolder_relative + f_testModelName, f_outputTestModel , ".fbx", m_sessionReference, f_item);

            return true;
        }
        catch
        {
            m_error = "Something went wrong, it crashed";            
        }

        return false;    
    }
}